package com.oocl.scp_ssh.scp;

import com.oocl.scp_ssh.pojo.impl.ScpMsg;


public class ScpJudge {

	private final String SCP  = "scp";
	
	///识别 scp命令
	public ScpMsg judge(String cmd){
		if(cmd==null||cmd.length()==0)return null;
		String[] ss = cmd.split("\\s");
		if(ss==null || ss.length<3)
			return null;
		if(!ss[0].matches(SCP))
			return null;
		
		String[] ss2 = ss[2].split("\\s*:\\s*");
		if(ss2== null || ss2.length<2)
			return null;
		return new ScpMsg(ss[1], ss2[0], ss2[1]);
	}
}
